package com.gyp.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyp.entity.SysJobRecord;
import com.gyp.mapper.user.SysJobRecordMapper;
import com.gyp.model.PageHandler;
import com.gyp.model.UserContextHolder;
import com.gyp.model.common.PageInfo;
import com.gyp.model.common.Search;
import com.gyp.service.SysJobRecordService;
import org.springframework.stereotype.Service;

@Service
public class SysJobRecordServiceImpl extends ServiceImpl<SysJobRecordMapper, SysJobRecord> implements SysJobRecordService {
    @Override
    public PageInfo<SysJobRecord> selectAnimationTaskJobs(Search param) {
        Page<SysJobRecord> page = lambdaQuery()
                .eq(SysJobRecord::getUserId, UserContextHolder.getUserId())
                .orderByDesc(SysJobRecord::getCreateTime)
                .page(new Page<>(param.getPageNum(), param.getPageSize()));
        return PageHandler.returnPage(page.getRecords(),param,page.getTotal());
    }
}
